package com.li.jiang.utils;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import net.bytebuddy.utility.dispatcher.JavaDispatcher;

@AllArgsConstructor
@Data
@NoArgsConstructor
@ApiModel(value="返回数据包", description="返回数据包")
public class ReturnMessage {
    @ApiModelProperty("返回信息")
    private String msg;
    @ApiModelProperty("状态码")
    private int code;
    @ApiModelProperty("数据")
    private Object data;
    @ApiModelProperty("其他附加内容")
    private Object other;

    public static ReturnMessage tokenError(String msg){
        return new ReturnMessage(msg,402,null,MyTimeUtil.getCurrentTime());
    }

    public static ReturnMessage error(String message) {
        return new ReturnMessage(message,400,null,MyTimeUtil.getCurrentTime());
    }

    public static ReturnMessage authError(String message) {
        return new ReturnMessage(message,402,null,MyTimeUtil.getCurrentTime());
    }
    public static ReturnMessage dataError(String message) {
        return new ReturnMessage(message,401,null,MyTimeUtil.getCurrentTime());
    }
    public static ReturnMessage success(String message,Object data) {
        return new ReturnMessage(message,200,data,MyTimeUtil.getCurrentTime());
    }
    public static ReturnMessage success(String message) {
        return new ReturnMessage(message,200,null,MyTimeUtil.getCurrentTime());
    }
}
